<?php include 'studentHeader.html'; ?>
<h2>Zaliczenia</h2>
<table>
	<tr>
		<th>Kod</th>
		<th>Nazwa</th>
		
		<th>Status</th>
	</tr>

<?php


error_reporting(E_ALL);
ini_set('display_errors', '1');
session_start();
$login=$_SESSION['login'];
		$link = pg_connect("host=labdb dbname=bd user=dt316119 password=x");
	

		$result = pg_query($link, "select kod, nazwa, minzal, termin, status from cwiczenia natural join ocena where indeks='$login' order by status");
		pg_close($link);
		$n = pg_num_rows($result);

		for($i = 0; $i < $n; $i++) {

			$row = pg_fetch_array($result, $i);
			echo "<tr>\n";
			echo "<td>", $row["kod"], "</td>\n";
			echo "<td>", $row["nazwa"], "</td>\n";
			
			echo "<td>", $row["status"], "</td>\n";

			echo "</tr>\n";

		}

?>

</table>